import request from '@/utils/request'
import { jdyadmin } from '@/settings'

/**
 * 部门设备信息
 */

// 获取部门设备信息
export function getDepartment(data){
  return request({
    url: `${jdyadmin}/departmentFacility/seleteUserPermission`,
    method: 'post',
    data
  })
}

// 修改部门设备信息
export function updateDepartment(data){
  return request({
    url: `${jdyadmin}/departmentFacility/updateDepartmentFacility`,
    method: 'post',
    data
  })
}

// 新增部门设备信息
export function addDepartment(data){
  return request({
    url: `${jdyadmin}/departmentFacility/addDepartmentFacility`,
    method: 'post',
    data
  })
}

// 删除部门设备信息
export function deleteDepartment(id){
  return request({
    url: `${jdyadmin}/departmentFacility/deleteDepartmentFacility/${id}`,
    method: 'delete'
  })
}


// 获取子设备列表
export function getChildrenDepartment(data){
  return request({
    url: `${jdyadmin}/departmentSubfacility/seleteUserPermission`,
    method: 'post',
    data
  })
}

// 新增子设备列表
export function addChildrenDepartment(data){
  return request({
    url: `${jdyadmin}/departmentSubfacility/addDepartmentFacility`,
    method: 'post',
    data
  })
}

// 修改子设备列表
export function updateChildrenDepartment(data){
  return request({
    url: `${jdyadmin}/departmentSubfacility/updateDepartmentFacility`,
    method: 'post',
    data
  })
}

// 删除子设备列表
export function deleteChildrenDepartment(id){
  return request({
    url: `${jdyadmin}/departmentSubfacility/deleteDepartmentFacility/${id}`,
    method: 'delete'
  })
}

// -----------------维修设备---------------------

// 查询维修设备信息
export function getRepair(data){
  return request({
    url: `${jdyadmin}/maintainFacility/seleteMaintainFacility`,
    method: 'post',
    data
  })
}
// 新增维修设备信息
export function addRepair(data){
  return request({
    url: `${jdyadmin}/maintainFacility/addMaintainFacility`,
    method: 'post',
    data
  })
}

// 修改维修设备信息
export function updateRepair(data){
  return request({
    url: `${jdyadmin}/maintainFacility/updateMaintainFacility`,
    method: 'post',
    data
  })
}

// 删除维修设备信息
export function deleteRepair(id){
  return request({
    url: `${jdyadmin}/maintainFacility/deleteMaintainFacility/${id}`,
    method: 'delete'
  })
}


/**
 * 领料单
 */

// 查询领料单
export function getLingliao(data){
  return request({
    url: `${jdyadmin}/jdyPacking/seleteJdyPacking`,
    method: 'post',
    data
  })
}

// 增加领料单
export function addLingliao(data){
  return request({
    url: `${jdyadmin}/jdyPacking/addJdyPacking`,
    method: 'post',
    data
  })
}

// 修改领料单
export function updateLingliao(data){
  return request({
    url: `${jdyadmin}/jdyPacking/updateJdyPacking`,
    method: 'post',
    data
  })
}

// 删除领料单
export function deleteLingliao(id){
  return request({
    url: `${jdyadmin}/jdyPacking/deleteJdyPacking/${id}`,
    method: 'delete'
  })
}

//领料审核
export function lingliaoShenhe(data){
  return request({
    url: `${jdyadmin}/departmentFacility/updatejdyCommodityFlow`,
    method: 'post',
    data
  })
}


// 部门设备生成二维码
export function bumenScEwm(data){
  return request({
    url: `${jdyadmin}/departmentFacility/adderweima`,
    method: 'post',
    data
  })
}

// 设备维修申请
// 查询维修申请
export function selectWxSq(data){
  return request({
    url: `${jdyadmin}/maintainReport/maintainReportService`,
    method: 'post',
    data
  })
}

// 新增维修申请
export function addWxSq(data){
  return request({
    url: `${jdyadmin}/maintainReport/addMaintainReport`,
    method: 'post',
    data
  })
}

// 设备申报与设备联查
export function wxSqLc(data){
  return request({
    url: `${jdyadmin}/maintainReport/maintainAllReportService`,
    method: 'post',
    data
  })
}

// 修改维修申请
export function updateWxSq(data){
  return request({
    url: `${jdyadmin}/maintainReport/updateMaintainReport`,
    method: 'post',
    data
  })
}

// 删除维修申请
export function deleteWxSq(id){
  return request({
    url: `${jdyadmin}/maintainReport/deleteMaintainReport/${id}`,
    method: 'delete'
  })
}

// 部门流程图
export function liuchengtu(data){
  return request({
    url: `${jdyadmin}/jdyFlowCatalog/seleteJdyFlowCatalog`,
    method: 'post',
    data
  })
}

//新增流程图
export function addliuchengtu(data){
  return request({
    url: `${jdyadmin}/jdyFlowCatalog/addJdySupplier`,
    method: 'post',
    data
  })
}

//修改流程图
export function writeliuchengtu(data){
  return request({
    url: `${jdyadmin}/jdyFlowCatalog/updateJdyRule`,
    method: 'post',
    data
  })
}

// 删除流程图
export function deleteliuchengtu(data){
  return request({
    url: `${jdyadmin}/jdyFlowCatalog/deleteJdyJdyRule/${data}`,
    method: 'DELETE',
  })
}

// 导入文件
export function importFile(data){
  return request({
    url: `${jdyadmin}/departmentFacility/addFacilityexcle`,
    method: 'post',
    data
  })
}